home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 6
/
The Arsenal Files 6 (Arsenal Computer).ISO
/
prg_basi
/
n_b-v200.zip
/
NB01
/
DMO
/
32BIT.DMO
next >
Wrap
Text File
|
1996-03-11
|
4KB
|
81 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME 32BIT .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
Using 32bit pointers are just like addressing a "Thank you" note to Grandma
with 2 exceptions: 1) 32bit pointers are shorter and easier!
2) You ain't'a'gonna' get no birthday goodies from RAM!
So, if you've never used pointers or DEF SEG in your life, now's the time
to start because it has NEVER been easier to directly access memory and the
speed and versatility are simply <<AWESOME>>!
Here's what you need to know:
* 32bit pointers are just BIG numbers and can be added to, subtracted from,
and passed around just like the DWORD they really are. They are NOT some
mysterious mumbo-jumbo no matter what the assembly and C programmers would
like you to think!
* Even though you can shoot yourself in the foot (metaphorically speaking)
with 32bit pointers you could do that with DEF SEG for years and I've
been loading the wrong values into variables since my Commodore 64 was
just a pile of California sand! There is no less nor no more guarantee
when using pointers so the playing field is level and there never were
any blanks in the gun!
* In fact, as 32bit pointers can save groups of code and typing so there
just may be an argument that using pointers reduces bugs, undocumented
features, and bugs. (Maybe we could get a $5B grant to study it.)
* When you DIM a PTR you can access the data at that address IMMEDIATELY
for both read and write! No fuss, no muss, just clean code. In fact you
can get really important data into/out of your machine's RAM that will
make your life easier. (Like the status of the <INS> key and others.)
* Finally and most importantly, when some technosnob starts jumping on your
case about programming in !BASIC! you can blow his little mind. (Not that
I've not been doing that for years with PowerBASIC but it's getting easier
and easier.) In fact, my favorite expressions, often heard, are:
"You wrote THIS in BASIC?" and "You can't do that in BASIC!".
Below is your playground go get to it! Then, when you're ready have a look
at the next file "32BITPTR.DMO" and we should be ready.
$endif
COLOR 7, 0
CLS
X% = 258
DIM X_ptr AS INTEGER PTR
DIM H_ptr AS BYTE PTR
DIM L_ptr AS BYTE PTR
X_ptr = VARPTR32( X% )
H_ptr = X_ptr
L_ptr = X_ptr + 1
PRINT @X_ptr
PRINT @H_ptr
PRINT @L_ptr
PRINT
@X_ptr = &hFFFF
PRINT @X_ptr
PRINT @H_ptr
PRINT @L_ptr